package com.itboye.mengwu.app.ui.mymeng;

import java.util.ArrayList;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.core.object.BaseActivity;
import com.itboye.mengwu.R;
import com.itboye.mengwu.app.ui.mymeng.fragment.MyMengMeShouDaoFragment;
import com.itboye.mengwu.app.ui.mymeng.fragment.MyMengMeZengSongFragment;
import com.itboye.mengwu.widget.PagerSlidingTabStrip;

public class MyMengMeZengSongActivity extends BaseActivity   {
	String titles[] = { "我赠送的", "我收到的" };
	ViewPager pager;
	ImageView back;
	TextView txt_title;
	ImageView img_other;
	PagerSlidingTabStrip tabs;
	ArrayList<Fragment> list;

	@Override
	public int initView() {

		return R.layout.activity_daijinquan_main;
	}

	class MyAdapter extends FragmentStatePagerAdapter {
		String[] _titles;

		public MyAdapter(FragmentManager fm, String[] _titles) {
			super(fm);
			this._titles = _titles;
		}

		@Override
		public CharSequence getPageTitle(int position) {
			return _titles[position];
		}

		@Override
		public Fragment getItem(int arg0) {
			Fragment bfrag2 = null;
			if(arg0==0){
				bfrag2=new MyMengMeZengSongFragment();
			}else{
				bfrag2=new MyMengMeShouDaoFragment();
			}

			return bfrag2;

		}

		@Override
		public int getCount() {
			return _titles.length;
		}

	}

	@Override
	public void onMyCreate() {
		// TODO Auto-generated method stub
		list = new ArrayList<Fragment>();
		// list.add(new RedBagWeiShiYong(0));
		// list.add(new RedBagWeiShiYong(1));
		// list.add(new RedBagWeiShiYong(2));
		txt_title.setText("我的赠送");
		img_other.setVisibility(View.GONE);
		pager.setAdapter(new MyAdapter(getSupportFragmentManager(), titles));
		tabs.setViewPager(pager);
		back.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});

	}

}
